package com.ldx.blog.pojo.request;

import com.ldx.blog.pojo.dataobject.BlogInfo;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotNull;

@Data
public class AddBlogRequest {
    @NotNull(message = "用户id不能为空")
    private Integer userId;
    private String title;
    private String content;

    public static BlogInfo trans(AddBlogRequest addBlogRequest){
        BlogInfo blogInfo = new BlogInfo();
        BeanUtils.copyProperties(addBlogRequest,blogInfo);
        return blogInfo;
    }

}
